#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "My_Own_SOFT_I2C_FOR_OLED.h"
#include "Mpu_6050.h"
#include "I2C_SOFT_GPIO.h"
#include "DMA_UART1.h"
#include "Uart.h"
#include <stdio.h>
#include "MPU6050_Reg.h"
int main(void)
{
    
    //OLED_Init();
    init_gpio(GPIO_Pin_6,GPIO_Pin_7);
    
	/*模块初始化*/

    init_oled();
    
    init_mpu_6050();
    
    
    init_dma_for_uart1();
    
    init_uart_with_dma();
    
	
    uint8_t  data[]= "luojunhua33";
    show_string(0,0,data);
    
    mpu6050_data mpu6050;
    
    static uint8_t bytes[100]  ;
    uint8_t temp[14];
    while (1)
    {  
       read_data(&mpu6050);
        
      
        
        
        sprintf((char *)bytes,"%d %d %d %d %d %d",
                mpu6050.x_acc,
                mpu6050.y_acc,
                mpu6050.z_acc,
                mpu6050.x_gyr,
                mpu6050.y_gyr,
                mpu6050.z_gyr
        
        );
        
       /*
        uint8_t high = read( 0x68,MPU6050_ACCEL_XOUT_H);
        uint8_t low = read( 0x68,MPU6050_ACCEL_XOUT_L);
        int16_t x_acc = high<<8 | low;
        
         high = read( 0x68,MPU6050_ACCEL_YOUT_H);
         low = read( 0x68,MPU6050_ACCEL_YOUT_L);
         int16_t y_acc = high<<8 | low;
        
         high = read( 0x68,MPU6050_ACCEL_ZOUT_H);
         low = read( 0x68,MPU6050_ACCEL_ZOUT_L);
         int16_t z_acc = high<<8 | low;

         sprintf((char *)bytes,"%5d %5d %5d %5d %5d %5d",
               x_acc,
               y_acc,
         z_acc,
         0,
         0,
         0
        
        );*/
        send(bytes,sizeof(bytes));
    }
}
